package com.example.modulepicselector.view.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import android.widget.Scroller;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.ViewPager;

import org.jetbrains.annotations.NotNull;



public class MyViewPager extends ViewPager {


    private final Scroller mScroller;



    public MyViewPager(@NonNull @NotNull Context context) {
        super(context);
        mScroller = new Scroller(getContext());
    }

    public MyViewPager(@NonNull @NotNull Context context, @Nullable @org.jetbrains.annotations.Nullable AttributeSet attrs) {
        super(context, attrs);
        mScroller = new Scroller(getContext());

    }

/*    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        boolean intercepted = false;

        switch (ev.getAction()){
            case MotionEvent.ACTION_DOWN:
                intercepted = false;
                if (mScroller .isFinished()){
                    mScroller.abortAnimation();
                    return  true;
                }
                return false;



            case MotionEvent.ACTION_MOVE:
                return true;


            default:return true;



        }
    }*/


    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        try {
            return super.onTouchEvent(ev);
        } catch (IllegalArgumentException ex) {
            ex.printStackTrace();
        }
        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        try {
            return super.onInterceptTouchEvent(ev);
        } catch (IllegalArgumentException ex) {
            ex.printStackTrace();
        }
        return false;
    }



}
